<!--新增会员-->
<template>
	<section class="webview fixHeight">
		<el-scrollbar style="height:100%">
			<!--      经纪人-->
			<el-form  ref="form" :model="detail" label-width="100px" class="form">


				<el-form-item label="姓名">
					<el-input v-model="detail.name" />
				</el-form-item>
				<el-form-item label="手机号">
					<el-input v-model="detail.phone" />
				</el-form-item>
				<el-form-item label="提交时间" v-if='type==1'>
					<el-input v-model="detail.createAt" />
				</el-form-item>
				<el-form-item label="从业年限">
					<el-input v-model="detail.designYear" />
				</el-form-item>
				<el-form-item label="设计报价"  v-if='type==2'>
					<el-input v-model="detail.designPirce"/>
				</el-form-item>
				<el-form-item label="个人介绍">
					<el-input v-model="detail.introduce"   type="textarea" :rows="4"/>
				</el-form-item>
				<el-form-item label="擅长风格" v-if='type==2'>
				  <el-select v-model="detail.style" multiple placeholder="请选择">
				    <el-option
				      v-for="item in detail.style"
				      :key="item"
				      :label="item"
				      :value="item"
				    />
				  </el-select>
				</el-form-item>
				<el-form-item label="所属公司" v-if='type==1'>
					<el-input v-model="detail.enterpriseName" />
				</el-form-item>
				<el-form-item label="所属门店" v-if='type==1'>
					<el-input v-model="detail.storeName" />
				</el-form-item>
				<el-form-item label="状态">
					<el-input v-model="detail.status" />
				</el-form-item>
				<el-form-item label="身份证正面" v-if='type==1'>
					<img style="width: 160px;" :src="detail.idcardFront" alt="">
				</el-form-item>
				<el-form-item label="设计师照片" v-if='type==2'>
					<img style="width: 160px;" :src="detail.designPirce" alt="">
				</el-form-item>
				<el-form-item label="身份证反面" v-if='type==1'>
					<img style="width: 160px;" :src="detail.idcardRear" alt="">
				</el-form-item>
				<el-form-item label="工牌" v-if='type==1'>
					<img style="width: 160px;" :src="detail.workCard" alt="">
				</el-form-item>
				<el-form-item>
					<!--          <el-button type="primary" @click="submit">提交</el-button>-->
					<el-button @click="cancel">返回</el-button>
					<el-button @click="ok">通过</el-button>
					<el-button @click="back">打回</el-button>
				</el-form-item>
			</el-form>
			



		</el-scrollbar>
	</section>
</template>
<script>
	import {
		agentUpdateStatus,
		detailDesigner,
		detailHomeHold,
		detailHomeDecoration
	} from '@/api/api'
	export default {
		data() {
			return {

				detail: {
					id: 0,
					type: 0
				}
			}
		},
		created() {
			
			var data = JSON.parse(this.$route.query.data);
			this.type = this.$route.query.type;
			
			this.id = data.id
			console.log(data.userId)
			if(this.$route.query.type ==2){
				
				detailDesigner(
					data.userId
				).then(data => {
					if(data.code == 200){
						this.detail=data.data
					}
				});
			}else if(this.$route.query.type ==3){
				console.log(data)
				detailHomeHold(
					data.userId
				).then(data => {
					if(data.code == 200){
						this.detail=data.data
					}
				});
			}else if(this.$route.query.type ==4){
				
				detailHomeDecoration(
					data.userId
				).then(data => {
					if(data.code == 200){
						this.detail=data.data
					}
				});
			}else if(this.$route.query.type == 1){
				this.detail = data
			}
			
			
			

		},
		methods: {
			ok() {
				var that = this;
				agentUpdateStatus({
					id: that.id,
					status: 0,
					type: that.type
				}).then(data => {
					Is.tip('设置成功')
					this.$router.go(-1)
				})
			},
			back() {
				var that = this;
				this.$prompt('请输入打回理由', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消'
				}).then(({
					value
				}) => {
					agentUpdateStatus({
						id: that.id,
						status: 4,
						remark: value,
						type: that.type
					}).then(data => {
						Is.tip('设置成功');
						this.$router.go(-1)
					});
				}).catch(() => {

				});


			}
		}
	}
</script>
